package operation;

import Book.BookList;

import java.util.Scanner;

/**
 * Created with Intellij IDEA.
 * Description:
 * User: 33013
 * Date: 2023-02-28
 * Time: 12:31
 */
public class FindOperation implements IOperation{

    @Override
    public void work(BookList bookList) {
        System.out.println("请输入要查找的书名");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        int pos = bookList.capacity;
        for (int i = 0; i < pos; i++) {
            if(name.equals(bookList.bookslist[i].getName())){
                System.out.println("找到了");
                System.out.println(bookList.bookslist[i]);
                return;
            }
        }
        System.out.println("查无此书");
    }
}
